package com.wm.blog.admin.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.wm.blog.center.common.utils.R;
import com.wm.blog.center.common.utils.login.StpAdminUtil;
import com.wm.blog.center.service.BlogService;
import com.wm.blog.center.vo.ws.BlogVo;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: weiming
 * @Date: 2021/5/27 10:07
 * @Description:
 */
@RestController
@Api(tags = "博客管理")
public class BlogController {

    @Resource
    BlogService blogService;

    @PostMapping("/blog/add")
    @SaCheckLogin(key = StpAdminUtil.KEY)
    public R addBlog(BlogVo blogVo){
        Boolean aBoolean = blogService.saveBlog(blogVo);
        if (aBoolean){
            return R.ok();
        } else {
            return R.error();
        }
    }
}
